//
//  PackParse.h
//  KangarooDoctor
//
//  Created by gang on 2024/2/8.
//

#import <Foundation/Foundation.h>
#import "defs.h"

NS_ASSUME_NONNULL_BEGIN

struct PortPayload{
    uint8_t cmd;
    void *param;
};

struct CBParam {
    uint8_t highPress;
    uint8_t lowPress;
    uint8_t heartBeat;
};

//0XCC
struct CCParam {
    uint8_t systolic;//收缩压 高压 mmHg
    uint8_t diastolic;//舒张压 低压 mmHg
    uint8_t pulse;//心率值
    uint8_t heartAnomaly;//心率是否不齐 1不齐, 0 齐
};

enum{
  WrapTypeWriteToPort = 0xbeb0,
  WrapTypeReadFromPort = 0xd0c2,//READ from 测量端
};

struct Wrap {
    uint16_t type;//0xd0, 0xc2 -> resp,  0xbe, 0xb0 -> req
    uint8_t payloadLen;
    
    void* payload;
    
    uint8_t check;
};



@interface PackParse : NSObject

+(void)test;

@end


int readWrap(const uint8_t *buffer, int buflen, struct Wrap *wrap);


NS_ASSUME_NONNULL_END
